<!DOCTYPE html>
<html lang="zh-cn">
    <head>
        <meta charset="UTF-8"/>
        <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
        <title>Document</title>
    </head>
    <body>
        <script>
            function App(props) {
              function handleClick() {
                props.dispatch({ type: 'app/create' });
              }
              return <div onClick={handleClick}>${props.name}</div>
            }
            // 等同于
            // class App extends React.Component {
            //   handleClick() {
            //     this.props.dispatch({ type: 'app/create' });
            //   }
            //   render() {
            //     return <div onClick={this.handleClick.bind(this)}>${this.props.name}</div>
            //   }
            // }
        </script>
    </body>
</html>